package org.bozo.im.service.protocols.facebook;

import java.util.ArrayList;

import org.bozo.im.common.types.Protocol;
import org.bozo.im.common.types.ProtocolRequirement;
import org.bozo.im.service.IMSession;
import org.bozo.im.service.IMSessionBuilder;
import org.bozo.im.service.IMSessionConfiguration;
import org.bozo.im.service.protocols.jabber.JabberSession;

public class FacebookSessionBuilder implements IMSessionBuilder {

	private static ArrayList<ProtocolRequirement> mRequirements;
	
	static {
		mRequirements = new ArrayList<ProtocolRequirement>();
		mRequirements.add(ProtocolRequirement.LOGIN_NAME);
		mRequirements.add(ProtocolRequirement.PASSWORD);
	}
	
	public ArrayList<ProtocolRequirement> getRequirements() {
		return mRequirements;
	}
	
	public IMSession buildSession(IMSessionConfiguration pConfiguration) {
		return new JabberSession(pConfiguration);
	}
	
	public IMSessionConfiguration buildConfiguration(String pLogin, String pPassword, String pServer, int pPort) {

		IMSessionConfiguration lRes = new IMSessionConfiguration();
		lRes.setPort(5222);
		lRes.setLogin(pLogin);
		lRes.setPassword(pPassword);
		lRes.setServer("chat.facebook.com");
		lRes.setProtocol(Protocol.FACEBOOK);
		
		return lRes;
	}
}
